package com.hospital.controller;

import com.hospital.constant.MessageConstant;
import com.hospital.result.Result;
import com.hospital.service.DepartmentService;
import com.hospital.vo.DepartmentIncomeVO;
import com.hospital.vo.DepartmentStatsVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.bridge.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/department")
@Slf4j
@Api(tags = "6.科室管理")
public class DepartmentController {
    @Autowired
    private DepartmentService departmentService;

    @GetMapping("/getDepartmentStats")
    @ApiOperation("获取科室统计信息")
    public Result<List<DepartmentStatsVO>> getDepartmentStats() {
        log.info("获取科室统计信息");
        List<DepartmentStatsVO> departmentStatsVOList = departmentService.getDepartmentStats();
        return Result.success(departmentStatsVOList, MessageConstant.QUERY_SUCCESS);
    }

    @GetMapping("/getDepartmentIncome")
    @ApiOperation("获取科室收入信息")
    public Result<List<DepartmentIncomeVO>> getDepartmentIncome() {
        log.info("获取科室收入信息");
        List<DepartmentIncomeVO> departmentIncomeVOList = departmentService.getDepartmentIncome();
        return Result.success(departmentIncomeVOList, MessageConstant.QUERY_SUCCESS);
    }
}
